package top.ninwoo.utils.util;

import top.ninwoo.utils.entity.Ovs;

/**
 * @Author joliu
 * @Description ovs 的工具接口
 * @Date　Create in 下午9:24 2019/10/20
 */
public interface OvsUtils {
    /**
     * ovs-vsctl --version
     * @return
     */
    boolean isInstall();

    /**
     * ovs-vsctl show
     * @return
     */
    Ovs showDetails();

    Ovs parseOvsString(String ovsString);

    String getValueInString(String input);

    /**
     * ovs-vsctl add-br
     * @param name
     * @return
     */
    void addBridge(String name);

    /**
     * ovs-vsctl set bridge [bridgeName]  protocols=[protocols]
     * @param bridgeName
     * @param protocol
     */
    void setBridgeProtocol(String bridgeName, String protocol);

    /**
     *  ovs-vsctl set-controller
     * @param bridgeName
     * @param host
     * @param port
     */
    void setController(String bridgeName, String host, int port);

    /**
     * ovs-vsctl del-br
     * @param name
     */
    void delBridge(String name);

    /**
     * TODO 待实现
     * @param bridgeName
     * @param port
     */
    boolean addBridgePort(String bridgeName, String port);

    boolean delBridgePort(String bridgeName, String port);

    String[] createVethPair(String br1, String br2);

    boolean delVethPort(String[] veths);

    boolean enableLinuxPort(String port);

    boolean enableLinuxPort(String[] ports);

    boolean setVxlan(String bridgeName, String remoteIp);

}
